//最底部新浪图标变换功能
/*
var sina = document.getElementById("sina");
sina.src = "img/f3.png";
sina.onmouseover = function() {
	this.src = "img/fh3.png";
}
sina.onmouseout = function() {
		this.src = "img/f3.png";
}
*/
//最底部新浪图标变换功能结束
	


//===========================登录和注册页------基本写法============================================

/*$id("log").onclick = function(){
	$id("board").style.display = "block";
	$id("logface").style.display = "block";
	animate($id("logface"),800,100);
}
$id("logface").getElementsByTagName("i")[0].onclick = function(){
	animate($id("logface"),1920,100,function(){
		$id("board").style.display = "none";
		$id("logface").style.display = "none";
		$id("logface").style.left = 0;
	});
}
$id("reg").onclick = function(){
	$id("board").style.display = "block";
	$id("regface").style.display = "block";
	animate($id("regface"),800,100);
}
$id("regface").getElementsByTagName("i")[0].onclick = function(){
	animate($id("regface"),1920,100,function(){
		$id("board").style.display = "none";
		$id("regface").style.display = "none";
		$id("regface").style.left = 0;
	});
}*/
//	这种写法需要给  蒙版 和 两个页面都加上  css中的属性： display : none;  

//================================基本写法结束====================================



//-------------------------------登录和注册页面向对象方法-----------------------------
/*
function Cut(handle,ele){
	this.handle = document.getElementById(handle);
	this.box = document.getElementById(ele);
	this.masking = document.getElementById("board");
	this.close = this.box.getElementsByTagName("i")[0];
	this.bWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
	this.target = (this.bWidth - this.box.offsetWidth)/2;
	this.speed = 90;
}
Cut.prototype.move = function(ele,target,speed,callback){
	clearInterval(ele.timer);
	var speed = ele.offsetLeft < target ? speed : -speed;
	ele.timer = setInterval(function(){
		var val = ele.offsetLeft - target;
		ele.style.left = ele.offsetLeft + speed + "px";
		if(Math.abs(val) <= Math.abs(speed)){
			clearInterval(ele.timer);
			ele.style.left = target + "px";
			if(callback){
				callback();
			}
		}
	},10)
}
Cut.prototype.start = function(){
	this.masking.style.visibility = "visible";
	this.box.style.visibility = "visible";
	this.move(this.box,this.target,this.speed);
}
Cut.prototype.stop = function(){
	var that = this;
	this.move(this.box,this.bWidth,this.speed,function(){
		that.masking.style.visibility = "hidden";
		that.box.style.visibility = "hidden";
		that.box.style.left = "0";
	})
}
Cut.prototype.init = function(){
	var that = this;
	this.handle.onclick = function(){
		that.start();
	}
	this.close.onclick = function(){
		that.stop();
	}
}
var log = new Cut("log","logface");
log.init();
var reg = new Cut("reg","regface");
reg.init();
//	--------------------------登录和注册页面面向对象写法结束---------------------------
*/

//	动画函数
/*
 
function animate(ele,target,speed,callback){
	clearInterval(ele.timer);
	var speed = ele.offsetLeft < target ? speed : -speed;
	ele.timer = setInterval(function(){
		var val = ele.offsetLeft - target;
		ele.style.left = ele.offsetLeft + speed + "px";
		if(Math.abs(val) <= Math.abs(speed)){
			clearInterval(ele.timer);
			ele.style.left = target + "px";
			if(callback){
				callback();
			}
		}
	},10)
}

*/
//	动画函数结束


//==================================-----jquery==============================
$(function(){
	//-------------------底部新浪图标--------------
	$('#sina').on({
		mouseover:function(){
			$(this).attr('src','img/fh3.png')
		},
		mouseout:function(){
			$(this).attr('src','img/f3.png')
		}
	})
	//------------------底部新浪图标结束-------------
	
	
//---------------------------登录和注册页面-----------------------	
	$('#log').on('click',function(){
		$('#board').fadeIn(100,function(){
			$('#logface').show().animate({
				left:"50%",
				marginLeft:"-190px"
			},100)
		});
	})
	$('#reg').on('click',function(){
		$('#board').fadeIn(100,function(){
			$('#regface').show().animate({
				left:'50%',
				marginLeft:"-190px"
			},100)	
		});
	})
	$('.close').on('click',function(){
		$(this).parent().animate({
			'left':'100%'
		},100,function(){
			$(this).hide(100,function(){
				$('#board').fadeOut(100);
				$(this).css({
					'left':0,
					'marginLeft':0
				});
			});
			
		})
	})
//-------------------------登录和注册页面over------------------------
	
})